'use strict';
/**
 * Created by FreezeSoul on 2015/9/29.
 */
define([
        'angular',
        'app/modules/editor/define',
    ],
    function(angular) {
        angular.module('ad.editor')
            .directive('adRowSelectDirective', function () {
                return {
                    template: '<input type="checkbox"/>',
                    scope: {
                        row: '=adRowSelectDirective'
                    },
                    link: function ($scope, $element, $attr, $ctrl) {
                        $element.bind('change', function (evt) {
                            if($scope.row.isSelected){
                                $scope.row.isSelected = false;
                                $element.parent().removeClass('st-selected');
                            }else{
                                $scope.row.isSelected = true;
                                $element.parent().addClass('st-selected');
                            }
                        });

                    }
                };
            });

    });
